﻿@using SCMS.Resource
@model IEnumerable<SCMS.UI.Models.TAnalysis>
<b>@Resources.TenderAnalysis_LoadTADetailz_TenderSuppliers</b>&nbsp
@Ajax.ActionLink(Resources.TenderAnalysis_LoadAddSupplier_NewSupplier, "Index", new { id = "LoadAddSuplier/" + ViewBag.TAID }, new AjaxOptions
{
    UpdateTargetId = "popupDiv",
    LoadingElementId = "loading",
    Url = Url.Action("LoadAddSuplier/" + ViewBag.TAID),
    OnSuccess = "ShowPopupDiv"
})

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@if (Model.Count() > 0)
{
    <table width="100%" align="center" cellspacing="0" cellpadding="5" border="1" style="border: 1px solid grey;
        border-collapse: collapse; padding: 5px; font-size: 12px;">
        <tr class="gridheader">
            <th rowspan="2" valign="middle">
                @Resources.Global_String_Company
            </th>
            <th colspan="2">
                @Resources.OrderRequest_String_OrderRequestItems
            </th>
            <th rowspan="2" valign="middle">
                @Resources.Global_String_Manage
            </th>
        </tr>
        <tr class="gridheader">
            <th>
                @Resources.Global_String_ItemName
            </th>
            <th>
                @Resources.TenderAnalysis_LoadTADetailz_ItemQuote
            </th>
        </tr>
        @{int x = 0; string rowClass = ""; }
        @foreach (var item in Model)
        {
            if (x % 2 == 0) { rowClass = "grideven"; }
            if (x % 2 != 0) { rowClass = "gridodd"; }
            if (x >= 0) { x = x + 1; }
            <tr class="grideven">
                <td>
                    @Html.DisplayFor(modelItem => item.SupplierName)
                </td>
                <td colspan="2">
                    &nbsp;
                </td>
                <td>
                    @Ajax.ActionLink(Resources.Global_String_Edit, "Index", new { id = "EditCategory" }, new AjaxOptions
           {
               UpdateTargetId = "popupDiv",
               LoadingElementId = "loading",
               Url = Url.Action("EditCategory/" + item.OtherID),
               OnSuccess = "ShowPopupDiv"
           }) |
                    @Ajax.ActionLink(Resources.Global_String_Delete, "Index", new { id = "DeleteCategory" }, new AjaxOptions
           {
               UpdateTargetId = "budgetDiv",
               LoadingElementId = "loading",
               Url = Url.Action("DeleteCategory/" + item.OtherID),
               Confirm = string.Format(Resources.Global_String_ConfirmDelete, item.SupplierName)
           })
                </td>
            </tr>
            foreach (var subItem in item.TBiderQuotes)
            { 
            <tr class="gridodd">
                <td>
                    &nbsp;
                </td>
                <td>
                    @Html.DisplayFor(s => subItem.OrderRequestItem.ItemDescription)
                </td>
                <td>
                    @Html.DisplayFor(s => subItem.UnitPrice)
                </td>
                <td>
                    @Ajax.ActionLink(Resources.Global_String_Edit, "Index", new { id = "EditSubLine" }, new AjaxOptions
                   {
                       UpdateTargetId = "popupDiv",
                       LoadingElementId = "loading",
                       Url = Url.Action("EditSubLine/" + subItem.Id.ToString()),
                       OnSuccess = "ShowPopupDiv"
                   }) |
                    @Ajax.ActionLink("Delete", "Index", new { id = "DeleteSubLine" }, new AjaxOptions
                   {
                       UpdateTargetId = "budgetDiv",
                       LoadingElementId = "loading",
                       Url = Url.Action("DeleteSubLine/" + subItem.Id.ToString()),
                       Confirm = string.Format(Resources.Global_String_ConfirmDelete, subItem.OrderRequestItem.ItemDescription)
                   })
                </td>
            </tr>
            }
            <tr class="gridodd">
                <th colspan="4" valign="middle" align="center">
                    @Resources.Global_String_TermsAndConditions
                </th>
            </tr>
            <tr class="gridodd">
                <td>
                    &nbsp;
                </td>
                <td>
                    @Resources.Global_String_TotalCost
                </td>
                <td>
                    @Html.DisplayFor(s => item.TransportCost)
                </td>
                <td>
                    @Ajax.ActionLink(Resources.Global_String_Edit, "Index", new { id = "EditSubLine" }, new AjaxOptions
               {
                   UpdateTargetId = "popupDiv",
                   LoadingElementId = "loading",
                   Url = Url.Action("EditSubLine/" + item.OtherID),
                   OnSuccess = "ShowPopupDiv"
               }) |
                    @Ajax.ActionLink(Resources.Global_String_Delete, "Index", new { id = "DeleteSubLine" }, new AjaxOptions
               {
                   UpdateTargetId = "budgetDiv",
                   LoadingElementId = "loading",
                   Url = Url.Action("DeleteSubLine/" + item.OtherID),
                   Confirm = Resources.TenderAnalysis_LoadTADetailz_ConfirmDeleteTerms
               })
                </td>
            </tr>
            <tr class="gridodd">
                <td>
                    &nbsp;
                </td>
                <td>
                    @Resources.Global_String_ShippingTerms
                </td>
                <td>
                    @Html.DisplayFor(s => item.ShippingTerm)
                </td>
                <td>
                    @Ajax.ActionLink(Resources.Global_String_Edit, "Index", new { id = "EditSubLine" }, new AjaxOptions
               {
                   UpdateTargetId = "popupDiv",
                   LoadingElementId = "loading",
                   Url = Url.Action("EditSubLine/" + item.OtherID),
                   OnSuccess = "ShowPopupDiv"
               }) |
                    @Ajax.ActionLink(Resources.Global_String_Delete, "Index", new { id = "DeleteSubLine" }, new AjaxOptions
               {
                   UpdateTargetId = "budgetDiv",
                   LoadingElementId = "loading",
                   Url = Url.Action("DeleteSubLine/" + item.OtherID),
                   Confirm = Resources.TenderAnalysis_LoadTADetailz_ConfirmDeleteTerms
               })
                </td>
            </tr>
            <tr class="gridodd">
                <td>
                    &nbsp;
                </td>
                <td>
                    @Resources.GoodsReceivedNote_LoadGRNVerifyItems_DeliveryDate
                </td>
                <td>
                    @Html.DisplayFor(s => item.DeliveryTime)
                </td>
                <td>
                    @Ajax.ActionLink(Resources.Global_String_Edit, "Index", new { id = "EditSubLine" }, new AjaxOptions
               {
                   UpdateTargetId = "popupDiv",
                   LoadingElementId = "loading",
                   Url = Url.Action("EditSubLine/" + item.OtherID),
                   OnSuccess = "ShowPopupDiv"
               }) |
                    @Ajax.ActionLink(Resources.Global_String_Delete, "Index", new { id = "DeleteSubLine" }, new AjaxOptions
               {
                   UpdateTargetId = "budgetDiv",
                   LoadingElementId = "loading",
                   Url = Url.Action("DeleteSubLine/" + item.OtherID),
                   Confirm = Resources.TenderAnalysis_LoadTADetailz_ConfirmDeleteTerms
               })
                </td>
            </tr>
            <tr class="gridodd">
                <td>
                    &nbsp;
                </td>
                <td>
                    @Resources.TenderAnalysis_String_Warranty
                </td>
                <td>
                    @Html.DisplayFor(s => item.Warrant)
                </td>
                <td>
                    @Ajax.ActionLink(Resources.Global_String_Edit, "Index", new { id = "EditSubLine" }, new AjaxOptions
               {
                   UpdateTargetId = "popupDiv",
                   LoadingElementId = "loading",
                   Url = Url.Action("EditSubLine/" + item.OtherID),
                   OnSuccess = "ShowPopupDiv"
               }) |
                    @Ajax.ActionLink("Delete", "Index", new { id = "DeleteSubLine" }, new AjaxOptions
               {
                   UpdateTargetId = "budgetDiv",
                   LoadingElementId = "loading",
                   Url = Url.Action("DeleteSubLine/" + item.OtherID),
                   Confirm = Resources.TenderAnalysis_LoadTADetailz_ConfirmDeleteTerms
               })
                </td>
            </tr>
            <tr class="gridodd">
                <td>
                    &nbsp;
                </td>
                <td>
                    @Resources.Global_String_PaymentTerms
                </td>
                <td>
                    @Html.DisplayFor(s => item.TermzOfPayment)
                </td>
                <td>
                    @Ajax.ActionLink(Resources.Global_String_Edit, "Index", new { id = "EditSubLine" }, new AjaxOptions
               {
                   UpdateTargetId = "popupDiv",
                   LoadingElementId = "loading",
                   Url = Url.Action("EditSubLine/" + item.OtherID),
                   OnSuccess = "ShowPopupDiv"
               }) |
                    @Ajax.ActionLink(Resources.Global_String_Delete, "Index", new { id = "DeleteSubLine" }, new AjaxOptions
               {
                   UpdateTargetId = "budgetDiv",
                   LoadingElementId = "loading",
                   Url = Url.Action("DeleteSubLine/" + item.OtherID),
                   Confirm = Resources.TenderAnalysis_LoadTADetailz_ConfirmDeleteTerms
               })
                </td>
            </tr>
            <tr class="gridodd">
                <td>
                    &nbsp;
                </td>
                <td>
                    @Resources.Global_String_Other
                </td>
                <td>
                    @Html.DisplayFor(s => item.others)
                </td>
                <td>
                    @Ajax.ActionLink(Resources.Global_String_Edit, "Index", new { id = "EditSubLine" }, new AjaxOptions
               {
                   UpdateTargetId = "popupDiv",
                   LoadingElementId = "loading",
                   Url = Url.Action("EditSubLine/" + item.OtherID),
                   OnSuccess = "ShowPopupDiv"
               }) |
                    @Ajax.ActionLink(Resources.Global_String_Delete, "Index", new { id = "DeleteSubLine" }, new AjaxOptions
               {
                   UpdateTargetId = "budgetDiv",
                   LoadingElementId = "loading",
                   Url = Url.Action("DeleteSubLine/" + item.OtherID),
                   Confirm = Resources.TenderAnalysis_LoadTADetailz_ConfirmDeleteTerms
               })
                </td>
            </tr>
        }
    </table>
    
}

